package wang.jingzhao.MDNotes;
import android.widget.*;
import android.content.*;
import java.util.*;
import android.view.*;

public class NoteAdapter extends ArrayAdapter
{
	private final int resourceId;

    public NoteAdapter(Context context, int textViewResourceId, List<Note> objects) {
        super(context, textViewResourceId, objects);
        resourceId = textViewResourceId;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Note note = (Note) getItem(position); // 获取当前项的Note实例
        View view = LayoutInflater.from(getContext()).inflate(resourceId, null);//实例化一个对象
        TextView Notename = (TextView) view.findViewById(R.id.note_name);//获取该布局内的便条标题
        TextView Notedescribe = (TextView) view.findViewById(R.id.note_describe);//获取该布局内的便条简介
        Notename.setText(note.getName());//为标题设置文本内容
        Notedescribe.setText(note.getDescribe());//为简介设置文本内容
        return view;
    }
}
